package com.youmu.sichuansfc.dao;

import com.youmu.sichuansfc.domain.YoumuCompany;
import com.youmu.sichuansfc.domain.pojo.AreaPojo;
import com.youmu.sichuansfc.domain.pojo.CompanyCountPojo;
import com.youmu.sichuansfc.dto.rsp.CompanyT;
import org.springframework.data.repository.Repository;

import java.sql.Timestamp;
import java.util.List;

public interface CompanyDao  extends Repository<YoumuCompany, Long> {


    /**
     *  添加数据
     * @param youmuCompany
     * @return
     */
    public YoumuCompany insert(YoumuCompany youmuCompany);

    /**
     *  查询
     * @param startTime
     * @param endTime
     * @param companyName
     * @param num
     * @param size
     * @return
     */
    public CompanyT findBy(Timestamp startTime, Timestamp endTime, String companyName, Integer companyStatus, int num, int size);

    /**
     *  通过ID 查询
     * @param id
     * @return
     */
    public YoumuCompany findById(long id);


    /**
     *  根据公司状态查询
     * @param youmuCompanys 状态 1 正常名单; 2 白名单； 3 灰名单; 4黑名单
     * @return
     */
    public List<YoumuCompany> findByCompanyType(int youmuCompanys);

    public int errorCompany();

    /**
     *  分类查询公司数量
     * @param sqlKey group by sqlKey
     * @param youmuAreas  地区S
     * @return
     */
    //@Query("SELECT y FROM YoumuCompany y where y.isDelete = true  and y.companyType = :companyType")
    public List<CompanyCountPojo> findByType(Integer sqlKey, List<AreaPojo> youmuAreas);
}
